package com.doudou.collection.security;

import com.doudou.collection.pojo.vo.UserVO;
import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @ClassName CustomUserDetails
 * @Description 自定义用户信息
 * @Author blue sky
 * @Date 2023/6/1 23:32
 * @Version 1.0
 */
@Getter
public class CustomUserDetails extends User {
    private Long id;
    private String email;
    private String phone;
    private String icon;

    public CustomUserDetails(UserVO userVO, Collection<? extends GrantedAuthority> authorities) {
        super(userVO.getUsername(), userVO.getPassword(), authorities);
        this.id = userVO.getId();
        this.email = userVO.getEmail();
        this.phone = userVO.getPhone();
        this.icon = userVO.getIcon();
    }
}
